﻿var dom = fl.getDocumentDOM();
var newSel = [];
newSel = dom.selection;

if( newSel.length <= 0 )
	alert( "Please make a selection on the stage" );
else
{
	for( i=0; i<dom.selection.length; i++ )
	{
		var item = dom.selection[ i ];
		var tmpName = item.libraryItem.name;
		var name = getName( tmpName );
		item.name = name;
	}
}

function getName( itemName )
{
	var split = itemName.split( "/" );
	var newName = split[ split.length - 1 ];
	return( newName );
}